//go:build wireinject

package wire

import (
	"github.com/gin-gonic/gin"
	"github.com/google/wire"
	v1 "go-pioneer/api/v1"
	"go-pioneer/internal/repository"
	"go-pioneer/internal/repository/dao"
	"go-pioneer/internal/service"
	"go-pioneer/ioc"
)

func InitWebServer() *gin.Engine {
	// 执行依赖注入相关内容
	wire.Build(
		// 注入接口抽象层面内容
		v1.NewExampleHandler,
		// 注入服务层面内容
		service.NewExampleService,
		// 注入数据访问层内容
		repository.NewExampleRepository,
		// 注入数据库层内容
		dao.NewExampleDAO,
		// 初始化Gin引擎
		ioc.InitMiddlewares,
		ioc.InitGinHandler,
	)
	return new(gin.Engine)
}
